
package org.wing.mouseListener;

import org.come.Frame.TestpackJframe;
import org.come.Frame.ZhuFrame;
import org.come.entity.Goodstable;
import org.come.until.GoodsListFromServerUntil;
import org.wing.panel.LHMainPanel;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class LHGoodsListMouseLitener extends MouseAdapter
{

	private int type;
	private LHMainPanel LHMainPanel;

	public LHGoodsListMouseLitener(int type, LHMainPanel LHMainPanel)
	{
		this.type = type;
		this.LHMainPanel = LHMainPanel;
	}

	public void mousePressed(MouseEvent e)
	{
		if (e.getButton() == 3)
		{
			if (type + (LHMainPanel.getPageNumber() - 1) * 25 >= GoodsListFromServerUntil.getWingGoodsList().size())
				return;
			Goodstable goodstable = (Goodstable)GoodsListFromServerUntil.getWingGoodsList().get(type + (LHMainPanel.getPageNumber() - 1) * 25);
			LHMainPanel.changeChooseWingGoods(goodstable, type + (LHMainPanel.getPageNumber() - 1) * 25);
		}
	}

	public void mouseEntered(MouseEvent e)
	{
		if (type + (LHMainPanel.getPageNumber() - 1) * 25 >= GoodsListFromServerUntil.getWingGoodsList().size())
			return;
		Goodstable goodstable = (Goodstable)GoodsListFromServerUntil.getWingGoodsList().get(type + (LHMainPanel.getPageNumber() - 1) * 25);
		if (goodstable != null)
			ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
	}

	public void mouseExited(MouseEvent e)
	{
		TestpackJframe.getTestpackJframe().getJpac().ClearText();
		ZhuFrame.getZhuJpanel().cleargoodtext();
	}

	public int getType()
	{
		return type;
	}

	public void setType(int type)
	{
		this.type = type;
	}
}
